package com.yunji.base.mapper;

import com.github.yulichang.base.MPJBaseMapper;
import com.yunji.base.dto.SiteFieldDTO;
import com.yunji.common.annotation.DataScope;
import com.yunji.common.model.domain.SiteDO;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Description: 网点Mapper接口$
 * @Author: HuaAo
 * @Date: 2024-04-02$
 */
public interface ISiteMapper extends MPJBaseMapper<SiteDO> {

    @DataScope
    @Select({"<script>SELECT distinct ${searchFiled} FROM t_site s  where s.del_flag = 0 ",
            "<if test='agentId != null'>AND b.agent_id = #{agentId}</if>",
            "<if test='siteTel != null'>AND s.site_tel LIKE concat('%', #{siteTel}, '%')</if>",
            "<if test='siteName != null'>AND s.site_name LIKE concat('%', #{siteName}, '%')</if></script>"})
    List<String> searchTableFiled(SiteFieldDTO param);
}
